package com.cloud.feign.service;

import com.cloud.feign.configuration.MultipartSupportConfiguration;
import com.cloud.feign.service.impl.FeignClientServiceImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

/**
 * 2020/3/18
 * FeignClientService
 *
 * @author machuanpeng
 */
@FeignClient(value = "eureka-client-demo", configuration = MultipartSupportConfiguration.class,fallback = FeignClientServiceImpl.class)
public interface FeignClientService {

    @GetMapping("/eureka/client/home")
    String homeFeignService(@RequestParam(value = "name") String name);

    /**
     * 文件上传.
     * 2020/3/18
     *
     * @param file file
     * @return java.lang.String
     * @author machuanpeng
     */
    @PostMapping(value = "/eureka/client/uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    String uploadFileFeignService(@RequestPart(value = "FeignFile") MultipartFile file);
}
